//
//  SearchView.h
//  Dispatch
//
//  Created by hyeyeon on 14. 1. 14..
//  Copyright (c) 2014년 hyeyeon. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>

#import "AppDelegate.h"
#import "ViewController.h"
#import "ListCell.h"
#import "AutoSearchView.h"
#import "PhotoViewController.h"


#import "EGORefreshTableHeaderView.h"

@class AutoSearchView;
@interface SearchView : UIView <UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate, EGORefreshTableHeaderDelegate>
{
    
    AppDelegate *appDelegate;
    
    //ui
    UISearchBar *mSearchView;
    UITableView *issueTableView;
    UITableView *starTableView;
    UILabel *resultCountLabel;
    UIButton *starButton;
    UIButton *issueButton;
    UIButton *topMoveButton;
    
    //자동완성
    NSMutableArray *autoArray;
    AutoSearchView *autoSearchView;
    
    
    //데이타
    BOOL duringNetwork;
    NSInteger requestIndex; //데이타 요청 1:이슈 2:스타
    BOOL requestIssue;  //yes:이슈버튼 누를때 이슈검색요청
    BOOL requestStar;   //yes:스타버튼 누를때 스타검색요청
    
    //바깥뷰
    UIButton *searchBGView;
    
    
    //스크롤잡을라고
	EGORefreshTableHeaderView *i_refreshHeaderView;
	EGORefreshTableHeaderView *s_refreshHeaderView;
	BOOL _reloading;
    
    UIView *activieiBGView;
    UIActivityIndicatorView *activityView;
    
    UIView *activieiBGView2;
    UIActivityIndicatorView *activityView2;
}
@property (nonatomic, assign) NSInteger currentIssuePageNumber;
@property (nonatomic, assign) NSInteger currentStarPageNumber;
@property (nonatomic, retain) NSMutableData *responseData;
@property (nonatomic, retain) NSString *currentKeyword; //현재 키워드

//받은데이타
@property (nonatomic, assign) NSInteger issueCount;
@property (nonatomic, assign) NSInteger starCount;
@property (nonatomic, assign) BOOL issueIsEnd;
@property (nonatomic, assign) BOOL starIsEnd;
@property (nonatomic, retain) NSMutableArray *issueArray;
@property (nonatomic, retain) NSMutableArray *starArray;
@property (nonatomic, retain) NSString *issueImageURL;
@property (nonatomic, retain) NSString *starImageURL;

@property (nonatomic, assign) CGRect searchFrame;

-(void)searchKeyword:(NSString *)keyword andIssue:(BOOL)yn andPageNumber:(NSInteger)pagenum;
-(void)selectIssueView:(BOOL)yn;
-(void)autoKeyword:(NSString*)keyword;  //자동검색창에서 넘어옴
@end
